#include <include/core/SkFont.h>
#include <include/core/SkFontMetrics.h>
#include <include/core/SkTypeface.h>

int main()
{
    SkFont sfont;
    const auto &stypeface = SkTypeface::MakeFromFile("out/DroidSansFallback.ttf");
    sfont.setTypeface(stypeface);
    sfont.setSize(stypeface->getUnitsPerEm());
    SkFontMetrics smetrics;
    sfont.getMetrics(&smetrics);
    printf("line height: %lf\n", smetrics.fDescent - smetrics.fAscent);

    printf("Flags: %d\n", smetrics.fFlags);
    printf("- UnderlineThicknessIsValid: %s\n", (SkFontMetrics::kUnderlineThicknessIsValid_Flag & smetrics.fFlags) ? "true" : "false");
    printf("- UnderlinePositionIsValid: %s\n", (SkFontMetrics::kUnderlinePositionIsValid_Flag & smetrics.fFlags) ? "true" : "false");
    printf("- StrikeoutThicknessIsValid: %s\n", (SkFontMetrics::kStrikeoutThicknessIsValid_Flag & smetrics.fFlags) ? "true" : "false");
    printf("- StrikeoutPositionIsValid: %s\n", (SkFontMetrics::kStrikeoutPositionIsValid_Flag & smetrics.fFlags) ? "true" : "false");
    printf("- BoundsInvalid: %s\n", (SkFontMetrics::kBoundsInvalid_Flag & smetrics.fFlags) ? "true" : "false");
    printf("Top: %lf\n", smetrics.fTop);
    printf("Ascent: %lf\n", smetrics.fAscent);
    printf("Descent: %lf\n", smetrics.fDescent);
    printf("Bottom: %lf\n", smetrics.fBottom);
    printf("Leading: %lf\n", smetrics.fLeading);
    printf("AvgCharWidth: %lf\n", smetrics.fAvgCharWidth);
    printf("MaxCharWidth: %lf\n", smetrics.fMaxCharWidth);
    printf("XMin: %lf\n", smetrics.fXMin);
    printf("XMax: %lf\n", smetrics.fXMax);
    printf("XHeight: %lf\n", smetrics.fXHeight);
    printf("CapHeight: %lf\n", smetrics.fCapHeight);
    printf("UnderlineThickness: %lf\n", smetrics.fUnderlineThickness);
    printf("UnderlinePosition: %lf\n", smetrics.fUnderlinePosition);
    printf("StrikeoutThickness: %lf\n", smetrics.fStrikeoutThickness);
    printf("StrikeoutPosition: %lf\n", smetrics.fStrikeoutPosition);
    return 0;
}
